Skip to content

Renaming functionality for Filter-presets#4861

Open
feyruzb wants to merge 4 commits into
Ericsson:masterfrom
feyruzb:refactor/rename-filter-presets-button
Open

Renaming functionality for Filter-presets#4861
feyruzb wants to merge 4 commits into
Ericsson:masterfrom
feyruzb:refactor/rename-filter-presets-button

Conversation

@feyruzb
Copy link
Copy Markdown
Collaborator

@feyruzb feyruzb commented May 23, 2026

This pull request adds the ability to rename filter presets throughout the CodeChecker system. It introduces a new backend API for renaming presets, updates the command-line interface and web UI to support this feature, and provides comprehensive tests for the new functionality. Additionally, the API and client versions are bumped to 6.71.0.

Rename filter preset feature:

  • Added a new renameFilterPreset RPC method to the codeCheckerDBAccess Thrift service, allowing filter presets to be renamed by ID. The method validates the new name, checks for duplicate names, and ensures the preset exists.
  • Implemented the renameFilterPreset method in the Python client and added a corresponding CLI command (filter-preset rename) with arguments for preset ID and new name.
  • Updated the Vue web UI to allow users to rename filter presets via a dialog, including UI changes and the necessary API call.

Testing improvements:

  • Added extensive functional tests for the new rename command, including tests for success, duplicate names, empty names, nonexistent IDs, and verifying the rename is reflected in the preset list.

Version bumps:

  • Bumped the API and client versions to 6.71.0 to reflect the new feature.

@feyruzb feyruzb added this to the release 6.29.0 milestone May 23, 2026
@feyruzb feyruzb self-assigned this May 23, 2026
@feyruzb feyruzb requested review from bruntib and vodorok as code owners May 23, 2026 23:53
@feyruzb feyruzb added API change 📄 Content of patch changes API! usability 👍 Usability-related features new feature 👍 New feature request labels May 23, 2026
@feyruzb feyruzb changed the title Refactor/rename filter presets button Renaming functionality for Filter-presets May 23, 2026
@dkrupp dkrupp modified the milestones: release 6.29.0, 6.28.1 May 26, 2026
@feyruzb feyruzb force-pushed the refactor/rename-filter-presets-button branch from ef6bb2a to 69b6af3 Compare May 26, 2026 13:06
@bruntib bruntib modified the milestones: 6.28.1, release 6.28.1 May 28, 2026
@feyruzb feyruzb linked an issue May 31, 2026 that may be closed by this pull request
@feyruzb feyruzb requested a review from gulyasgergely902 May 31, 2026 23:07
Copy link
Copy Markdown
Collaborator

@gulyasgergely902 gulyasgergely902 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only left some minor questions / issues.

if not name or not name.strip():
raise codechecker_api_shared.ttypes.RequestFailed(
codechecker_api_shared.ttypes.ErrorCode.DATABASE,
"Preset name cannot be empty!")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either use "xyz cannot be empty" or "Invalid xyz" but choose one and stick with it. I'd use "Preset name cannot be empty" and "Preset ID cannot be empty" since this error is thrown because a required argument was left out and so it cannot be invalid if it is empty.

if not preset_id:
raise codechecker_api_shared.ttypes.RequestFailed(
codechecker_api_shared.ttypes.ErrorCode.DATABASE,
"Invalid preset ID!")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add an empty line between validation and the actual query of the filter preset for better readability.

def renameFilterPreset(self, preset_id: int, name: str):
"""
Rename a filter preset.
Returns the ID of the renamed preset.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are supplying the preset_id which you want to rename, it is not much information to return it at the end too. I'd return a success instead like a 0 and raise (as currently implemented) if there was any error during. What was the motivation behind returning the preset_id?

color="primary"
:disabled="!presetName"
@click="saveCurrentFilter(saveMode)"
@click="saveMode !== 'rename'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move this logic to the function "saveCurrentFilter()" instead. Also it could be renamed to savePreset and it could handle saving and renaming too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API change 📄 Content of patch changes API! new feature 👍 New feature request usability 👍 Usability-related features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter Preset renaming button.

4 participants